<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserGroupsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_groups', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->bigInteger('user_id')   ->default(0)        ->comment('发起拼团的用户');
            $table->bigInteger('system_groups_id')->default(0)  ->comment('拼的团');
            $table->bigInteger('course_id') ->default(0)        ->comment('课程id');
            $table->integer('join_num')     ->default(0)        ->comment('加入人数');
            $table->tinyInteger('status')   ->default(0)        ->comment('1拼团中，2拼团成功，3拼团失败，4取消拼团');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
//        Schema::dropIfExists('user_groups');
    }
}
